Amazon Simple Notification Service (Amazon SNS)
💡 Definition
Amazon Simple Notification Service (Amazon SNS) is a fully managed messaging service that enables you to decouple microservices, distributed systems, and serverless applications. It provides a flexible, fully managed, fast, inexpensive, and push-based messaging service to send messages to a large number of subscribers.
🔑 Key Concepts
- Publisher/Subscriber (Pub/Sub) Model: Publishers send messages to a topic, and subscribers receive these messages.
- Topics: A logical access point and a communication channel to send messages to subscribed endpoints.
- Fanout: A single message published to an SNS topic can be delivered to multiple types of subscribing endpoints.
- Supported Endpoints: Subscribers can be HTTP/HTTPS endpoints, email, SMS, Lambda functions, Amazon SQS queues, mobile push notifications (e.g., Apple, Google), and Kinesis Firehose.
- Decoupling: Allows different parts of your application to communicate asynchronously without being tightly coupled.
⚙️ How it Works
A publisher (e.g., an application, a CloudWatch Alarm) sends a message to an SNS topic. SNS then delivers this message to all endpoints that are subscribed to that topic. For example, a single topic can send an email to administrators, an SMS to on-call staff, and trigger a Lambda function for automated processing, all simultaneously.
🎯 Use Cases
- Application-to-Person (A2P) Messaging: Sending notifications directly to individual users (e.g., SMS for order updates, email alerts).
- Application-to-Application (A2A) Messaging: Decoupling microservices or event-driven architectures by broadcasting events to multiple subscribers.
- Monitoring & Alerting: Notifying administrators of critical events detected by CloudWatch Alarms.
- Workflow Automation: Triggering Lambda functions or other services in response to specific events.
💰 Pricing Model
- Per Million Publications: Charged per million published messages.
- Deliveries: Charged per million deliveries to various endpoint types (e.g., SMS, email, mobile push).
📝 Exam Tips (CLF-C02)
- Keywords: "Push notifications", "Pub/Sub", "Decouple applications", "Fanout", "Email, SMS, Lambda, SQS".
- Remember SNS is a push-based service, sending messages directly to subscribers.
- Often paired with SQS for reliable message queuing and delivery to applications that process messages asynchronously.
See Also: * Lambda * CloudWatch Alarms * SQS (MISSING) * EventBridge